package com.jiayinlending.jiayindai.activity.myrepay;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;

import com.jiayinlending.jiayindai.R;
import com.jiayinlending.jiayindai.activity.base.BaseActivity;
import com.jiayinlending.jiayindai.adapter.LoanDetailsRecylerAdpater;
import com.jiayinlending.jiayindai.net.bean.Info;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class LoanDetailsActivity extends BaseActivity {

    @Bind(R.id.recyler_loandetails)
    RecyclerView recylerLoandetails;
    @Bind(R.id.btn_beginhuankuan)
    Button btnBeginhuankuan;
    @Bind(R.id.schedule)
    Button schedule;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        initRecylerview();
        getToolbarTitle().setText("借贷详情");
        getSubTitle().setText("");
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_loan_details;
    }

    private void initRecylerview() {
        ArrayList<Info> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add(new Info());
        }
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recylerLoandetails.setLayoutManager(layoutManager);
        recylerLoandetails.setAdapter(new LoanDetailsRecylerAdpater(this, list));

    }


    @OnClick({R.id.btn_beginhuankuan, R.id.schedule})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_beginhuankuan:
                startActivity(new Intent(LoanDetailsActivity.this,RepaymentActivity.class));
                break;
            case R.id.schedule:
                startActivity(new Intent(LoanDetailsActivity.this,ScheduledActivity.class));
                break;
        }
    }

}
